<!doctype html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>后台登录</title>
        <meta name="renderer" content="webkit|ie-comp|ie-stand">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport"
              content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>

        <link rel="stylesheet" href="/css/xadmin.css">
        <script type="text/javascript" src="/js/jquery-3.1.1.min.js"></script>
        <script type="text/javascript" src="/js/vue.js"></script>


    </head>
    <body class="login-bg">

        <div class="login" id="login">
            <div class="message">用户登录</div>
            <div id="darkbannerwrap"></div>
            <hr class="hr15">
            <form id="user">
                <input name="userName" placeholder="用户名" v-model="user.userName" type="text" class="layui-input">
                <hr class="hr15">
                <input name="passWord" v-model="user.passWord" placeholder="密码" type="password">
                <hr class="hr15">
                <input value="登录" @click="login()" style="width:100%;" type="button">
                <a th:href="@{/user/login1Page}">邮箱登录</a>
                <hr class="hr20">
            </form>
        </div>

        <script>
            new Vue({
                el: "#login",
                data: {
                    user: {
                        userName: "",
                        passWord: "",
                    }
                },
                methods: {
                    login: function () {
                        var self = this;
                        $.ajax({
                            url: "/userReful/login",
                            type: "post",
                            contentType: "application/x-www-form-urlencoded",
                            data: self.user,
                            dataType: "json",
                            success: function (data) {
                                console.log(data);
                                alert(data.info);
                                if (data.info == "登录成功") {
                                    window.location.href = "/user/indexPage";
                                }
                            }
                        })
                    }
                }
            })
        </script>
    </body>
</html>